﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel.DataAnnotations;

using HasuSLLib.Attributes;
using HasuSLLib;
using HasuSLUI;
using System.ComponentModel;

namespace UIGenDemoModel
{
    public enum EmpType
    {
        Permanent,
        Temporary,
        Apprentice,
        Student
    }

    public enum Country
    {
        UK,
        India,
        USA
    }

    public enum County
    {
        Middx,
        Essex,
        Ken,
        Other
    }


    public class Employee //: INotifyPropertyChanged
    {
        public const string KEY_Company = "1. Company Details";
        public const string KEY_ADDRESS = "2. Address Details";
        public const string KEY_STATUS = "3. Status";
        public const string KEY_PAY= "4. Pay";

        #region Employeement details

        #region EmpNo
        private int _empNo =0;
        /// <summary>
        /// EmpNo
        /// </summary>
        [Display(Name = "Employee No", GroupName = KEY_Company, Order = 1, Description = "Employee Number")]
        [Required]
        public int EmpNo
        {
            get { return _empNo; }
            set { _empNo = value; }
        }

        #endregion EmpNo 

        #region EmpName
        private string _empName = "tmp emp";
        /// <summary>
        /// EmpName
        /// </summary>
        [Display(Name = "Employee Name", GroupName = KEY_Company, Order = 2, Description = "Employee full Name")]
        [Required()]
        [StringLength(5,MinimumLength=1)]
        public string EmpName
        {
            get { return _empName ; }
            set { _empName = value; }
        }

        #endregion EmpName 
       

        
        #region Dob
        private DateTime _dob; //= new DateTime();
        /// <summary>
        /// Dob
        /// </summary>
        [Display(Name = "Date of Birth", GroupName = KEY_Company, Order = 3, Description= "Enter Date Of Birth" )]
        [Required]
        public DateTime Dob
        {
            get { return _dob; }
            set { _dob = value; }
        }

        #endregion Dob 


        #region DOJ
        private Date _doj; //= new Date();
        /// <summary>
        /// DOJ
        /// </summary>
        [Display(Name = "Joining Date", GroupName = KEY_Company,Order=3)]
        [Required]
        public Date DOJ
        {
            get { return _doj; }
            set { _doj = value; }
        }
        #endregion DOJ 

        
        #region EmpType
        private EmpType _emptype= EmpType.Permanent;
        /// <summary>
        /// EmpType
        /// </summary>
        [Display(Name = "Employeement Type", GroupName = KEY_STATUS, Order = 4)]
        public EmpType EmpType
        {
            get { return _emptype; }
            set { _emptype = value; }
        }
        #endregion EmpType 


        #region Active
        private bool _active= true;
        /// <summary>
        /// Active
        /// </summary>
        [Display(Name = "Active", GroupName = KEY_STATUS, Order = 5)]
        public bool Active
        {
            get { return _active; }
            set { _active = value; }
        }
        #endregion Active 

        #endregion

        Address _currentAddress = new Address();

        [Display(Name = "CurrentAddress", GroupName = KEY_STATUS, Order = 6 )]
        [Visualization(LableAt = LabelLocation.Top,Enable= false )]
        public Address CurrentAddress 
        {
            get { return _currentAddress; }
            set { _currentAddress= value ;  }
        }

        #region AddressList
        private AdressCollcetion _addressList = new AdressCollcetion() { new Address{ PostCode= "abc"} };
        /// <summary>
        /// AddressList
        /// </summary>
        [Display(Name = "AddressList", GroupName = KEY_STATUS, Order = 5)]
        public AdressCollcetion AddressList
        {
            get { return _addressList; }
            set { _addressList = value; }
        }

        #endregion AddressList 

        #region Address Details

        [Display(Name = "Address1", GroupName = KEY_ADDRESS, Order = 6)]
        public string Addr1 { get; set; }

        [Display(Name = "Address2", GroupName = KEY_ADDRESS, Order = 7)]
        public string Addr2 { get; set; }

        [Display(Name = "Address3", GroupName = KEY_ADDRESS, Order = 8)]
        public string Addr3 { get; set; }

        [Display(Name = "Post code", GroupName = KEY_ADDRESS, Order = 9)]
        public string Postcode { get; set; }

        [Display(Name = "County", GroupName = KEY_ADDRESS, Order = 10)]
        public County County { get; set; }

        private CountryLookup _country = new CountryLookup();

        [Display(Name = "Country", GroupName = KEY_ADDRESS, Order = 11)]
        public CountryLookup Country { get { return _country; } set { _country = value; } }


        #endregion

        #region pay details

        [Display(Name = "Salary", GroupName = KEY_PAY, Order = 5)]
        public decimal Salary { get; set; }

        [Display(Name = "Bonus", GroupName = KEY_PAY, Order = 5)]
        public decimal Bonus { get; set; }
        #endregion


        public Employee()
        {
            PropertyChanged += new PropertyChangedEventHandler(Employee_PropertyChanged);
        }

        void Employee_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            ;
        }
        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
}
